package com.shrct.businessprocess.organization

import edu.fudan.langlab.domain.organization.MultiValuedRoleContributor
import org.springframework.stereotype.Component
import org.springframework.beans.factory.annotation.Autowired
import java.util.Collection
import edu.fudan.langlab.domain.organization.SingleValuedRoleContributor

@Component("RCSalesRoleContributor")
class RCSalesRoleProvider implements MultiValuedRoleContributor {

	@Autowired
	private RCOrganizationService orgainzationService;
	
	override Collection<RCEmployee> getParties() {
		orgainzationService.getRoleAssignment(roleId).map[it.employee].toSet
	}

	override getDescription() {
		"销售"
	}
	
	override getRoleId() {
		"RCSales"
	}
}

@Component("RCSalesLeaderRoleProvider")
class RCSalesLeaderRoleProvider implements SingleValuedRoleContributor{
	
	@Autowired
	private RCOrganizationService orgainzationService;
	override RCEmployee getParty() {
		orgainzationService.getRoleAssignment(roleId).map[it.employee].findFirst[true]
	}
	
	override getDescription() {
		"总经理审批助理"
	}
	
	override getRoleId() {
		"SalesLeader"
	}
}

@Component("RCCEORoleProvider")
class RCCEORoleProvider implements SingleValuedRoleContributor{
	
	@Autowired
	private RCOrganizationService orgainzationService;
	override RCEmployee getParty() {
		orgainzationService.getRoleAssignment(roleId).map[it.employee].findFirst[true]
	}
	
	override getDescription() {
		"CEO"
	}
	
	override getRoleId() {
		"CEO"
	}
}

@Component("RCBusinessProcessorRoleProvider")
class RCBusinessProcessorRoleProvider implements MultiValuedRoleContributor{
	
	@Autowired
	private RCOrganizationService orgainzationService;
	override Collection<RCEmployee> getParties() {
		orgainzationService.getRoleAssignment(roleId).map[it.employee].toSet
	}
	
	override getDescription() {
		"商务"
	}
	
	override getRoleId() {
		"BusinessProcessor"
	}
}

@Component("RCBusinessLeaderRoleProvider")
class RCBusinessLeaderRoleProvider implements SingleValuedRoleContributor{
	
	@Autowired
	private RCOrganizationService orgainzationService;
	override RCEmployee getParty() {
		orgainzationService.getRoleAssignment(roleId).map[it.employee].findFirst[true]
	}
	
	override getDescription() {
		"商务经理"
	}
	
	override getRoleId() {
		"BusinessLeader"
	}
}

@Component("RCPurchaseLeaderRoleProvider")
class RCPurchaseLeaderRoleProvider implements SingleValuedRoleContributor{
	
	@Autowired
	private RCOrganizationService orgainzationService;
	override RCEmployee getParty() {
		orgainzationService.getRoleAssignment(roleId).map[it.employee].findFirst[true]
	}
	
	override getDescription() {
		"采购经理"
	}
	
	override getRoleId() {
		"RCPurchaseLeader"
	}
}


@Component("RCFinanceLeaderRoleProvider")
class RCFinanceLeaderRoleProvider implements SingleValuedRoleContributor{
	
	@Autowired
	private RCOrganizationService orgainzationService;
	override RCEmployee getParty() {
		orgainzationService.getRoleAssignment(roleId).map[it.employee].findFirst[true]
	}
	
	override getDescription() {
		"财务经理"
	}
	
	override getRoleId() {
		"RCFinanceLeader"
	}
}

@Component("RCFinanceManRoleProvider")
class RCFinanceManRoleProvider implements SingleValuedRoleContributor{
	
	@Autowired
	private RCOrganizationService orgainzationService;
	override RCEmployee getParty() {
		orgainzationService.getRoleAssignment(roleId).map[it.employee].findFirst[true]
	}
	
	override getDescription() {
		"出纳财务"
	}
	
	override getRoleId() {
		"RCFinanceMan"
	}
}
@Component("RCInvoiceFinanceManRoleProvider")
class RCInvoiceFinanceManRoleProvider implements SingleValuedRoleContributor{
	
	@Autowired
	private RCOrganizationService orgainzationService;
	override RCEmployee getParty() {
		orgainzationService.getRoleAssignment(roleId).map[it.employee].findFirst[true]
	}
	
	override getDescription() {
		"开票财务"
	}
	
	override getRoleId() {
		"RCInvoiceFinanceMan"
	}
}

@Component("RCSaleEngineerProvider")
class RCSaleEngineerProvider implements MultiValuedRoleContributor{
	
	@Autowired
	private RCOrganizationService orgainzationService;
	override Collection<RCEmployee> getParties() {
		orgainzationService.getRoleAssignment(roleId).map[it.employee].toSet
	}
	
	override getDescription() {
		"售前工程师"
	}
	
	override getRoleId() {
		"SaleEngineer"
	}
}

@Component("RCProductManagerProvider")
class RCProductManagerProvider implements MultiValuedRoleContributor{
	
	@Autowired
	private RCOrganizationService orgainzationService;
	override Collection<RCEmployee> getParties() {
		orgainzationService.getRoleAssignment(roleId).map[it.employee].toSet
	}
	
	override getDescription() {
		"产品经理"
	}
	
	override getRoleId() {
		"ProductManager"
	}
}
@Component("RCFaultReportDispatcherProvider")
class RCFaultReportDispatcherProvider implements MultiValuedRoleContributor{
	
	@Autowired
	private RCOrganizationService orgainzationService;
	override Collection<RCEmployee> getParties() {
		orgainzationService.getRoleAssignment(roleId).map[it.employee].toSet
	}
	
	override getDescription() {
		"CASE管理员"
	}
	
	override getRoleId() {
		"FaultReportDispatcher"
	}
}
@Component("RCMarkedFaultReportDispatcherProvider")
class RCMarkedFaultReportDispatcherProvider implements MultiValuedRoleContributor{
	
	@Autowired
	private RCOrganizationService orgainzationService;
	override Collection<RCEmployee> getParties() {
		orgainzationService.getRoleAssignment(roleId).map[it.employee].toSet
	}
	
	override getDescription() {
		"标记CASE管理员"
	}
	
	override getRoleId() {
		"MarkedFaultReportDispatcher"
	}
}
@Component("RCServiceDispatcherProvider")
class RCServiceDispatcherProvider implements MultiValuedRoleContributor{
	
	@Autowired
	private RCOrganizationService orgainzationService;
	override Collection<RCEmployee> getParties() {
		orgainzationService.getRoleAssignment(roleId).map[it.employee].toSet
	}
	
	override getDescription() {
		"服务专员"
	}
	
	override getRoleId() {
		"ServiceDispatcher"
	}
}

@Component("RCServiceManagerProvider")
class RCServiceManagerProvider implements SingleValuedRoleContributor{
	
	@Autowired
	private RCOrganizationService orgainzationService;
	override getParty() {
		orgainzationService.getRoleAssignment(roleId).map[it.employee].findFirst[true]
	}
	
	override getDescription() {
		"服务经理"
	}
	
	override getRoleId() {
		"ServiceManager"
	}

	
}
@Component("RCServiceEngineerProvider")
class RCServiceEngineerProvider implements MultiValuedRoleContributor{
	
	@Autowired
	private RCOrganizationService orgainzationService;
	override Collection<RCEmployee> getParties() {
		orgainzationService.getRoleAssignment(roleId).map[it.employee].toSet
	}
	
	override getDescription() {
		"服务工程师"
	}
	
	override getRoleId() {
		"ServiceEngineer"
	}
	
}

@Component("RCCTOProvider")
class RCCTOProvider implements SingleValuedRoleContributor{
	
	@Autowired
	private RCOrganizationService orgainzationService;
	override getParty() {
		orgainzationService.getRoleAssignment(roleId).map[it.employee].findFirst[true]
	}
	
	override getDescription() {
		"技术总监"
	}
	
	override getRoleId() {
		"CTO"
	}

}
@Component("RCTechSupportProvider")
class RCTechSupportProvider implements MultiValuedRoleContributor{
	
	@Autowired
	private RCOrganizationService orgainzationService;
	override Collection<RCEmployee> getParties() {
		orgainzationService.getRoleAssignment(roleId).map[it.employee].toSet
	}
	
	override getDescription() {
		"技术支持经理"
	}
	
	override getRoleId() {
		"TechSupport"
	}
}
@Component("RCSeniorEngineerProvider")
class RCSeniorEngineerProvider implements MultiValuedRoleContributor{
	
	@Autowired
	private RCOrganizationService orgainzationService;
	override Collection<RCEmployee> getParties() {
		orgainzationService.getRoleAssignment(roleId).map[it.employee].toSet
	}
	
	override getDescription() {
		"资深工程师"
	}
	
	override getRoleId() {
		"SeniorEngineer"
	}
}

@Component("RCNormalUserProvider")
class RCNormalUserProvider implements MultiValuedRoleContributor{
	
	@Autowired
	private RCOrganizationService orgainzationService;
	override Collection<RCEmployee> getParties() {
		orgainzationService.getRoleAssignment(roleId).map[it.employee].toSet
	}
	
	override getDescription() {
		"普通用户"
	}
	
	override getRoleId() {
		"NormalUser"
	}
}
@Component("RCManagerUserProvider")
class RCTesterProvider implements MultiValuedRoleContributor{
	
	@Autowired
	private RCOrganizationService orgainzationService;
	override Collection<RCEmployee> getParties() {
		orgainzationService.getRoleAssignment(roleId).map[it.employee].toSet
	}
	
	override getDescription() {
		"经理"
	}
	
	override getRoleId() {
		"ManagerUser"
	}
}
